package com.example.springboot.mapper;

import com.example.springboot.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user WHERE username = #{username}")
    User selectByUsername(String username);
    @Select("SELECT * FROM user WHERE id = #{id}")
    User selectById(Integer id);
    @Insert("INSERT INTO user (username, password) VALUES (#{username}, #{password})")
    int insert(User user);
    @Update("UPDATE user SET avatar=#{avatar} WHERE id = #{id}")
    int update(User user);
}
